<template>
	<view v-if="loginDataLength.length > 0">
		<view class="me_content">
			<view class="header">
				<view class="header_img">
					<image :src="loginData.avatarUrl" mode="widthFix"></image>
				</view>
				<view class="header_info">
					<view class="header_name">
						{{loginData.nickName}}
					</view>
					<view class="header_vip">
						加入会员
					</view>
				</view>
			</view>
			<view class="me_order">
				<view class="me_order_header">
					<view class="me_order_header_title">
						我的订单
					</view>
					<view class="me_order_header_all">
						查看全部订单<FontAwesome class="fa_icon" type="fas fa-chevron-right"></FontAwesome>
					</view>
				</view>
				<view class="me_order_tab">
					<view class="me_order_tab_item" v-for="(item,index) in orderData" :key="item.index">
						<uni-badge size="small" :text="item.number" absolute="rightTop" type="primary">
							<view class="me_order_tab_item_view">
								<FontAwesome class="me_order_tab_item_icon" :type="item.icon"></FontAwesome>
								<view class="me_order_tab_item_text">{{item.text}}</view>
							</view>
						</uni-badge>
					</view>
				</view>
			</view>
			<view class="me_list">
				<view class="me_list_item" v-for="(item,index) in meList" :key="item.index">
					<view class="me_list_item_content">
						<FontAwesome class="me_list_item_icon" :type="item.icon"></FontAwesome>
						<text>{{item.text}}</text>
					</view>
					<view class="me_list_item_link">
						>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import FontAwesome from '../../components/Am-FontAwesome/index.vue';
	export default {
		data() {
			return {
				loginData:{
					avatarUrl: "",
					nickName: "",
				},
				loginDataLength:"",
				orderData: [{
					icon: "fas fa-wallet",
					text: "待付款",
					number: 0,
				}, {
					icon: "fas fa-archive",
					text: "待发货",
					number: 1,
				}, {
					icon: "fas fa-shipping-fast",
					text: "待收货",
					number: 4,
				}, {
					icon: "fas fa-comment-alt",
					text: "待评价",
					number: 0,
				}, {
					icon: "fas fa-money-check-alt",
					text: "退款售后",
					number: 0,
				}, ],
				meList: [{
					icon: "fas fa-map-marker-alt",
					text: "收货地址"
				}, {
					icon: "fas fa-bookmark",
					text: "我的收藏"
				}, {
					icon: "fas fa-comment-dots",
					text: "联系客服"
				}, {
					icon: "fas fa-cog",
					text: "设置"
				}, ]
			}
		},
		components: {
			FontAwesome,
		},
		methods: {
		},
		onLoad() {
			this.loginData.avatarUrl = getApp().globalData.loginData.avatarUrl
			this.loginData.nickName = getApp().globalData.loginData.nickName
			this.loginDataLength = Object.keys(this.loginData)
		}
	}
</script>

<style lang="scss" scoped>
	.me_content {
		.header {
			display: flex;
			align-items: center;
			padding: 40rpx;

			.header_img {
				width: 100rpx;
				height: 100rpx;
				border-radius: 50%;
				// border: 2rpx solid $color;
				box-shadow: 0px 0px 3px 1px #d3a978;
				overflow: hidden;

				image {
					display: block;
					width: 100%;
					height: 100%;
				}
			}

			.header_info {
				flex: 1;
				padding-left: 20rpx;
				display: flex;
				flex-direction: column;

				.header_name {
					height: 45rpx;
					font-size: 34rpx;
					font-weight: bold;
				}

				.header_vip {
					width: 30%;
					padding: 5rpx;
					text-align: center;
					font-size: 20rpx;
					border-radius: 50rpx;
					background: #d3a978;
				}
			}
		}

		.me_order {
			.me_order_header {
				padding: 20rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.me_order_header_title {
					font-size: 34rpx;
				}

				.me_order_header_all {
					font-size: 30rpx;
					color: #c2c2c2;
				}
			}

			.me_order_tab {
				display: flex;
				align-items: center;
				justify-content: space-evenly;
				padding: 30rpx 0;
				position: relative;

				.me_order_tab_item {
					/deep/ .uni-badge--primary {
						background-color: #d3a978;
					}

					.me_order_tab_item_view {
						text-align: center;

						.me_order_tab_item_icon {
							width: 90rpx;
							height: 90rpx;
							display: block;
							font-size: 65rpx;
							color: $color;
						}

						.me_order_tab_item_text {
							font-size: 24rpx;
						}
					}

				}
			}
		}

		.me_list {
			padding: 20rpx;

			.me_list_item {
				padding: 15rpx 0;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.me_list_item_content {
					display: flex;
					align-items: center;

					.me_list_item_icon {
						width: 50rpx;
						height: 50rpx;
						display: block;
						text-align: center;
						font-size: 40rpx;
						color: #333;
						margin-right: 20rpx;
					}

					text {
						font-size: 30rpx;

					}
				}

				.me_list_item_link {
					font-size: 34rpx;
					color: #8f8f8f;
				}

			}

		}
	}
</style>
